package com.jx.controller.api;

import com.jx.common.result.AjaxResult;
import com.jx.pojo.vo.statistics.StatisticsVO;
import com.jx.service.statistics.StatisticsService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 统计
 */
@RestController
@RequestMapping("/api/statistics")
public class StatisticsApiController {

    @Resource
    private StatisticsService statisticsService;

    /**
     * 更新流量
     */
    @PostMapping("/updateTraffic")
    public AjaxResult updateTraffic(@RequestBody StatisticsVO statisticsVO) {
        statisticsService.updateTraffic(statisticsVO);
        return AjaxResult.success();
    }

    /**
     * 文章访问量+1
     */
    @PostMapping("/increaseArticleVisits")
    public AjaxResult increaseArticleVisits(@RequestBody StatisticsVO statisticsVO) {
        statisticsService.increaseArticleVisits(statisticsVO);
        return AjaxResult.success();
    }

}
